package org.nbict.iot.persist.pool;

import org.nbict.iot.persist.Repo;
import org.nbict.iot.persist.RepoPool;
import org.nbict.iot.persist.repo.InfluxRepo;
import org.nbict.iot.persist.repo.MongoRepo;
import org.nbict.iot.persist.repo.MysqlRepo;
import org.nbict.iot.persist.repo.RedisRepo;

/**
 * Created by songseven on 18/6/15.
 */
public enum DbRepository implements RepoPool {

    MONGO,
    INFLUX,
    REDIS,
    MYSQL;

    private DbRepository() {
        switch (this.name()) {
            case "MONGO":
                instance = new MongoRepo();
                break;
            case "INFLUX":
                instance = new InfluxRepo();
                break;
            case "REDIS":
                instance = new RedisRepo();
                break;
            case "MYSQL":
                instance = new MysqlRepo();
        }
    }

    private Repo instance;

    @Override
    public Repo getInstance() {
        return instance;
    }
    
//    public static void main(String[] args) {
//        DbRepository.MONGO.getInstance();
//    }
}
